/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LinkLabel.java
 *
 * Created on Jan 25, 2012, 8:51:37 PM
 */
package chatclient.applets.components;

import java.awt.Color;

/**
 *
 * @author Adam
 */
public class LinkLabel extends javax.swing.JPanel {

    /** Creates new form LinkLabel */
    public LinkLabel() {
        initComponents();
    }

    public LinkLabel(String linkText, Color textColor) {
        initComponents();
        
        setLinkText(linkText);
        this.setSize(linkText.length(), this.getHeight());
        this.setForeground(textColor);
    }
    
    public void setLinkText(String value)
    {
        this.lblLinkText.setText(value);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        lblLinkText = new javax.swing.JLabel();

        setBackground(new java.awt.Color(0, 0, 0));
        setForeground(new java.awt.Color(0, 51, 255));

        lblLinkText.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        lblLinkText.setForeground(new java.awt.Color(0, 102, 255));
        lblLinkText.setName("lblLinkText"); // NOI18N

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, lblLinkText, org.jdesktop.beansbinding.ELProperty.create("Click to open"), lblLinkText, org.jdesktop.beansbinding.BeanProperty.create("toolTipText"));
        bindingGroup.addBinding(binding);

        lblLinkText.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblLinkTextMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblLinkText, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblLinkText, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
        );

        lblLinkText.getAccessibleContext().setAccessibleName("lblLinkText");

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

    private void lblLinkTextMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblLinkTextMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_lblLinkTextMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel lblLinkText;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
